home *** CD-ROM | disk | FTP | other *** search
/ Macwelt 1 / Macwelt DVD 1.toast / Web-Publishing / HTML-Editoren / Alpha ƒ / Help / Setext Help < prev    next >
Encoding:
Text File  |  2000-12-27  |  42.1 KB  |  994 lines

  1. .. -*-Setx-*-
  2.  
  3.                                           help authors: Donavan Hall,
  4.                                                         Craig Barton Upright,
  5.                                                         Ian Feldman
  6.  
  7.                                           help version: 2.0
  8.                                                created: 00-12-07 11.55.16 
  9.                                            last update: 00-12-27 23.54.51 
  10.     
  11. Introduction
  12. ============
  13.  
  14.  
  15. Setext stands for Structure Enhanced Text.  It is a markup scheme for plain
  16. text documents such as email messages and e-zines.  Setext's primary goal
  17. is to provide a way of marking text that is visually unobtrusive, so that
  18. if you don't have a special setext browser, like EasyView, you can still
  19. read the text.  (Have you ever tried to make sense of HTML source without
  20. your web browswer?)
  21.  
  22. The document below is a description of setext concepts written by Ian
  23. Feldman.  Setext grabbed a foothold in the Mac world with the online
  24. publication TidBITS. Rudimentary setext browsers were built with HyperCard
  25. for reading TidBITS. Setext seems to be merely a historical curiousity now.
  26.  
  27. Alpha has a setext mode.  The only thing that the mode does is facilitate
  28. marking the file.  Text mode has no marking facility.  If you write a lot
  29. of text documents and wished you could mark them with Alpha's mark menu
  30. (the little box up in the righthand corner of the window with the M in it),
  31. then you might find the Setext mode useful.
  32.  
  33. I've appended version 9 of the setext specification to the end of this file
  34. for anyone who is curious.
  35.  
  36. (NOTE: Setext is easier to use with mono-spaced fonts like Monoco.)
  37.  
  38.  
  39.    - Donavan Hall, Tuesday, March 14, 2000
  40.  
  41.  
  42. ------------------------------------------------------------------
  43.  
  44.  
  45. Summary of how the file marking works
  46. =====================================
  47.  
  48.  
  49. Any two lines that look like this:
  50.  
  51. Any string of words
  52. ===================
  53.  
  54. will be marked as a Chapter heading.  Any two lines that look like this:
  55.  
  56. Any other string of words
  57. -------------------------
  58.  
  59. will be marked as a Section heading.  That's all there is to it.  The long
  60. lines of dashes that you see separating sections in this document have
  61. nothing to do with the file marking, and have been included simply to make
  62. reading it a little easier.
  63.  
  64. The key bindings <command>-<=> and <command>-<-> will turn the current
  65. line into a chapter or heading, and remark the file.
  66.  
  67. ------------------------------------------------------------------
  68.  
  69.  
  70. Version 2.0 of Setx mode
  71. ========================
  72.  
  73. After Donavan sent me this excellent description of what Setext is (was?),
  74. I have developed a fondness for the mode and use it exclusively for various
  75. README.TXT files that I often write to annotate my work -- as Donavan
  76. mentions, the marking function is quite handy.  I decided to update the
  77. mode, allowing the user to set additional preferences, including comment
  78. characters, magic characters, keyword definitions, keyword symbols and
  79. "string" colors.
  80.  
  81. All of this can be done via the " Config --> Mode Prefs --> Preferences "
  82. dialog box.  In some ways, Setx could be thought of as "Text2", with the
  83. same functionality, but greater customization available.  If Alpha does not
  84. have a mode that you need, Setx could be adapted to serve as a surrogate
  85. until you've convinced someone to write one for you.  The current version
  86. of Setx, orginally written by Tom Pollard, is the long-awaited 1.1 .
  87.  
  88.  
  89. Comment Characters
  90. ------------------
  91.  
  92. Setext per se has no comment character, but I often use one in my
  93. README.TXT files.  Setx's Mode Preferences now allows the user to define
  94. both a single comment character (like this: # ), as well as paired (or
  95. bracketed) comment characters. 
  96.  
  97. This is an example of /* bracketed comments */, which can also /* extend 
  98. over 
  99. several */ lines.
  100.  
  101.  
  102. Any Section or Subsection heading which is preceded by the single comment 
  103. character, as indicated below, will be colorized, but the comment character 
  104. (and any leading white-spaces) will be stripped from the mark.
  105.  
  106.  
  107. # Magic Characters
  108. ------------------
  109.  
  110. The user can also specify one (and only one) "magic character."  Anything
  111. appearing after the magic character and before the next space will be
  112. colored according to the "magic color" preference.  $This is an example of 
  113. how one could use the $ sign as a magic character.
  114.  
  115.  
  116. # Keywords
  117. ----------
  118.  
  119. Setx now allows the user to define string colors and set keyword
  120. dictionaries as well through the " Mode Prefs --> Preferences " dialog. 
  121. Three levels of keywords are available, as well as a symbols category (for
  122. characters such as @ or %).
  123.  
  124. If the lists of desired keywords is rather long, the user might rather
  125. include them in a separate SetxPrefs files.  To create one, go to
  126. " Config --> Mode Prefs --> Edit Prefs File ",  and add these lines:
  127.  
  128.  
  129.  
  130. regModeKeywords -a -k $SetxmodeVars(keyword1Color) \
  131.   Setx  {blah bladdity} 
  132.  
  133. regModeKeywords -a -k $SetxmodeVars(keyword2Color) \
  134.   Setx  {blah2 bladdity2} 
  135.  
  136. regModeKeywords -a -k $SetxmodeVars(keyword3Color) \
  137.   Setx  {blah3 bladdity3} 
  138.  
  139. regModeKeywords -a -k $SetxmodeVars(symbolColor)   \
  140.   Setx  {! ^} 
  141.  
  142. Setx::colorizeSetx
  143.  
  144.  
  145.  
  146. Include as many keywords as desired within the braces, separating each
  147. keyword by at least one space or carriage return.  After editing a
  148. SetxPrefs.tcl file, you must " Config --> Mode Prefs --> Load Prefs File ". 
  149. Alpha will automatically load this preferences file when it restarts.
  150.  
  151. Note that deletions from any user-defined keyword dictionaries will only
  152. take effect upon restart -- keywords cannot be "unloaded".
  153.  
  154. The default mode preferences are intended to show off some of Setx's new
  155. functionality, which can be observed in this help file.  All of these 
  156. preferences could be set empty if desired.
  157.  
  158.  
  159.    - Craig Barton Upright, 08 April, 2000
  160.  
  161.      <cupright@princeton.edu>
  162.  
  163.  
  164. # Command Double Click
  165. ----------------------
  166.  
  167. Setx mode contains four "Search Url" preferences that are initially set to 
  168. four different popular web search engines.  Command double-clicking on any 
  169. text will send it to "Search Url 1".  Holding down any modifier key will 
  170. send the text to a different search url, using the table below:
  171.  
  172. option key:     Search Url 2
  173. control key:    Search Url 3
  174. shift key:      Search Url 4
  175.  
  176. Note that command double-clicking with NO modifier keys can also be accessed 
  177. using the F6 key binding.  This means that one can first highlight text, and 
  178. then hit F6 to send a phrase to the first search url.  The other modifiers, 
  179. however, can only send the word surrounding the current cursor point.
  180.    
  181.  
  182. ------------------------------------------------------------------
  183.    
  184.    
  185. Setext Concepts by Ian Feldman
  186. ==============================
  187.  
  188.   From setext-info Thu, 5 Mar 92 19:56:00 +0100 (CET)
  189.   Subject: setext_concepts_Mar92.etx
  190.   Status: RO
  191.  
  192.   # Message from   Ian Feldman, the Current Setext Oracle
  193.   # Date:          Thu, 5 Mar 92 19:56:00 +0100 (CET)
  194.   # Reply-to:      setext-info@random.se (Keepers of The Setext Flame[tm])
  195.   # X-new-address: no more mail to <not.bad.se> please
  196.   # Lines: 229
  197.   # Subject:       setext_concepts_Mar92.etx
  198.  
  199.   Thank you for your interest in the setext format.  Enclosed is
  200.   an advance sheet that will remain in effect until the first
  201.   public release of the setext format package (originally planned
  202.   for around March 1st, 1992, now delayed).
  203.  
  204.   If you recognize some of the arguments presented here then that
  205.   is the price that you are paying for having been an early bird. 
  206.   ;-)) Please note that my email address may change in the near
  207.   future; consult the trailer of weekly issues of TidBITS for the
  208.   most current one.
  209.  
  210.  
  211. What is setext
  212. --------------
  213.  
  214.   As originally explained in TidBITS\#100 and mentioned there from
  215.   now on, that publication now comes "wrapped as a setext."  The
  216.   noun itself stands for both a method to wrap (format) texts
  217.   according to specific layout rules and for a single
  218.   _structure_enhanced_ text.  The latter is a text which has been
  219.   formatted in such a fashion that it contains clues as to the
  220.   typographical and logical structure of its source
  221.   (word-processed) document(s), if any.  Those clues, which I call
  222.   "typotags," facilitate later automatic detection of that
  223.   structure so it can be validated and extracted/ processed/
  224.   transformed/ enhanced as needed, if needed.
  225.  
  226.   It follows that setexts, being nothing but pure text (albeit
  227.   with a special layout), are eminently readable using ANY editor
  228.   or word processor in existence today or tommorrow, and not only
  229.   on the Macintosh either.  ANY computer, any computer program
  230.   that is capable of opening and reading text files can be used
  231.   for reading setexts.  By default all properly setext-ized files
  232.   will have an ".etx" or ".ETX" suffix.  This stands for an
  233.   "emailable/ enhanced text", the ExtraTerrestial overtones
  234.   nothwistanding ;-))
  235.  
  236.   Unlike other forms of text encoding that use explicit, visible
  237.   tag elements such as <this> and <\that>, the setext format
  238.   relies solely on the presence of _implicit_ typotags, carefully
  239.   chosen to be as visually unobtrusive as possible.  The
  240.   underlined word above is one such instance of the defacto
  241.   "invisible" coding.  Inserted typotags will at worst appear as
  242.   mere "typos" in the text.
  243.  
  244.   Similarly, just to give an example, here is a short description
  245.   of the four types of word emphasis typotags that setexts MAY
  246.   contain, limited to one emphasis type ONLY per word or word
  247.   group:
  248.  
  249.   -------------------  ----------------------------  --------------
  250.         **aBoldWord**  **multiple bold words**       ; bold-tt
  251.   _anUnderlinedWord_    _multiple underlined words_  ; underline-tt
  252.       ~anItalicWord~    ~multiple italicised words~  ; italic-tt
  253.            aHotWord_     multiple_hot_words_         ; hot-tt
  254.   -----------------------------------------------------------------
  255.   the 'hot-tt' is synonymous with the 'grouped' style of HyperCard
  256.  
  257.   Please note, however, that the <end> strings previously found in
  258.   TidBITS\#100-109 were not part of the format as such, but were
  259.   added by Adam Engst for a specific setext-raterrestrial purpose.
  260.  
  261.  
  262. Why is setext
  263. -------------
  264.  
  265.   Data formats like the RTF (Rich Text Format) and SGML (Standard
  266.   Graphic Markup Language) have been designed for processing ONLY
  267.   by software.  Setext, on the other hand, has been _optimized_
  268.   for reading directly by human eyes on what probably is still the
  269.   lowest common denominator of today's computer hardware, an 80-
  270.   character by 24-line terminal screen (or, in effect, any
  271.   computer screen).  It follows that the format is intended
  272.   chiefly for smaller texts, those of a size that a human reader
  273.   might find within her capacity of overview.
  274.  
  275.   I need to state explicitly that although TidBITS is currently
  276.   the only setext publication in wide distribution, the setext is
  277.   NOT synonymous with that of TidBITS's layout.  Many other
  278.   distinctive layouts are possible.  TidBITS is therefore just an
  279.   _instance_ of the format, not THE setext format.  More
  280.   specifically, that also means that any of you thinking of
  281.   writing a "TidBITS browser" should in reality be considering a
  282.   "setext browser."  Otherwise your program will in all
  283.   probability be able to recognize only today's
  284.   specifically-formatted TidBITS and no other future setext
  285.   publications (which are in the making), including that of a
  286.   future possibly changed or modified TidBITS.
  287.  
  288.  
  289. How come is setext
  290. ------------------
  291.  
  292.   The idea of a common format for online-distributed publications
  293.   grew in my mind since approximately 1986-87.  It came into focus
  294.   after I started corresponding with Adam C. Engst, following my
  295.   April, 1990 criticism of the original TidBITS presented as a
  296.   HyperCard stack.  Gradually it ceased to be a redesign effort
  297.   for the TidBITS and became instead a generic format for all
  298.   kinds of electronic publications (which I affectionately call
  299.   "the compu- rags" ;-)).  I hit on the current "tagless" version
  300.   of the format in the winter of 1990 and the first internal beta
  301.   product -- a setext encoder for TidBITS -- saw the light of the
  302.   day in July of 1991.  Later Adam wrote a setext-encoding Nisus
  303.   macro for his personal use, the one he now uses to wrap the
  304.   weekly issues of TidBITS (he isn't putting all those spaces and
  305.   dashes in there entirely by hand!  ;-))
  306.  
  307.   As can be seen from the above setext is not some quickie
  308.   project, though up and finalized in a few afternoons.  A lot of
  309.   thought has gone into it and some of it has survived to the
  310.   present day.  Needless to say the format definition will be
  311.   placed in the public domain and its use actively promoted by the
  312.   many parties that have expressed an interest in adopting it for
  313.   their own use.
  314.  
  315.  
  316. What for is setext
  317. ------------------
  318.  
  319.   The setext (data) format is intended primarily for use by
  320.   online- distributed periodic publications.  It is particularly
  321.   well-suited to all kinds of electronic digests and other types
  322.   of repetitively disseminated text information.  Despite its
  323.   formal appearance as "mere stream of unenhanced ASCII characters
  324.   on a computer screen" setext is rich enough and unambiguous
  325.   enough to permit construction of fairly complex encoding engines
  326.   for specific application purposes (also on top of the format)
  327.   and to allow easy implementation of a countless number of
  328.   front-end browsers/ decoders and other reading/
  329.   archiving-enhancement tools.
  330.  
  331.   While setext does, indeed, allow the preservation of a source
  332.   text's structure it does not, by definition, guarantee the 100%
  333.   ability to recreate it at the destination.  Any word originally
  334.   styled as **bold** may in effect end up as Yellow-On-Black or be
  335.   set in a different font, or considered a candidate for a
  336.   cumulative keywords list or be deemphasized at will.  There are
  337.   not now and never will be any rules to govern how decoded
  338.   setexts should be presented at the receiving end.  It will be up
  339.   to each front-end's author to ensure that decoded
  340.   (no-longer-)setexts are presented in a fashion that's agreeable
  341.   to his/ her end users.  There is plenty of sound advice and
  342.   recommendations on how to achieve that but that's an entirely
  343.   different matter.
  344.  
  345.   Those principles also apply to decoding of a setext's logical,
  346.   rather than merely its typographical, structure.  The format
  347.   does not rely on some large set of predefined, unambiguous,
  348.   mutually- exclusive rules.  Rather, it "knows of" just the
  349.   barest set of typotags (currently 14), knows their symbolic
  350.   purpose and what criteria to use when looking for and validating
  351.   them in a setext.  This approach differs some from the commonly
  352.   heard programmers' wish for clearly-delimited data patterns that
  353.   can be scanned for quickly and their position used as an offset
  354.   to the text to be displayed.
  355.  
  356.   Setext has those patterns too but, since it relies primarily on
  357.   defacto "invisible" elements that could also be part of the text
  358.   itself, it must validate them first before proceeding with any
  359.   enhancements.  Writing a real setext decoder is therefore
  360.   conceptually much closer to (though nowhere near as hard as)
  361.   writing an SGML application than it is to writing a macro
  362.   routine to munge some data in one predefined fashion.  In spite
  363.   of all that, setext tools should be easily implementable with,
  364.   and no more complex than, typical HyperTalk, sed, awk and perl
  365.   scripts.  The barest minimum required for such an attempt is an
  366.   intelligent search/ replace function in a programmable macro
  367.   editor.  Though yet to be proven, conceptually there is nothing
  368.   in the format to prevent implementation of real-time setext
  369.   browsers written in, say, some advanced pattern-matching macro
  370.   language of a terminal emulator program.
  371.  
  372.  
  373. Where is setext
  374. ---------------
  375.    
  376.   There are yet no known setext tools in existence.  I have a
  377.   working prototype of a browser, which is not far from
  378.   completion.  I've also submitted a paging macro routine for rn
  379.   (a popular newsreader under unix) to TidBITS (\#110), which
  380.   should ease jumping between the topics.  I've also opened a
  381.   mailing list for developers and future setext publishers:
  382.   <setext-list@random.se> If you received this letter in your mail
  383.   then you're already a subscriber of it.  Otherwise please send
  384.   me a short note, stating whether you're interested in writing a
  385.   setext tool or merely just an interested observer/ future user
  386.   and your Internet-accessible email address and I will put you on
  387.   the list and/ or reply as soon as possible.
  388.  
  389.  
  390. When is setext
  391. --------------
  392.  
  393.   Due to a varying work load and other distractions between the
  394.   original announcement of the planned release and the actual date
  395.   of it, the browser that I am writing is not yet ready.  I do not
  396.   intend to repeat the mistake of preannouncing it again.  Instead
  397.   please feel free to join the mailing list through which the rest
  398.   of the specifications will be published.  The full release will
  399.   contain approximately 150K worth of setexts on setext along with
  400.   a demo browser written in HyperCard (2.0) that will permit
  401.   showing of the format's capabilities in a dynamic rather than
  402.   the strictly textual and sequential fashion.  Those of you who
  403.   know me, know also of the high standards of coding that I try to
  404.   adhere to.
  405.  
  406.   If you're among those that have already written a prototype
  407.   that's based mainly on a reverse-engineered layout of the
  408.   current TidBITS then you'd be well advised not to release it
  409.   without prior validation of it by me.  Please do not call your
  410.   product a "setext browser" (or whatever) UNLESS it is truly
  411.   capable of parsing all (future) setextized docs, not solely
  412.   TidBITS.
  413.  
  414.  
  415. How is setext
  416. -------------
  417.  
  418.   A lot can (and will) be said about it but there is one claim no
  419.   other text encoding method can make: "there is a lot more of me
  420.   than meets the eye" ;-))
  421.  
  422.  
  423. Who is setext
  424. -------------
  425.  
  426.   The setext format and its underlying philosophy isBroughtToYouBy
  427.   Ian Feldman <ianf@random.se>.  I live in Stockholm, Sweden,
  428.   Europe.  I used to work as and describe myself variously over
  429.   the years but now simply contend myself with being just a free
  430.   Human Factors thinker and tinkerer.
  431.  
  432.  
  433. .. last line contains a twodot-tt, a tag signifying the logic end of
  434. .. text while those three lines are all suppress-typotagged ones, i.e.
  435. .. can be suppressed (hidden) by a front-end application by default.
  436. ..
  437.  
  438.  
  439. ------------------------------------------------------------------
  440.  
  441.  
  442. Setext Sermon #1
  443. ================
  444.  
  445.   This information brought to you by the TidBITS Fileserver,
  446.   conveniently located near you at <fileserver@tidbits.uucp>.  To
  447.   speak with a human, send email to Adam C. Engst at
  448.   <ace@tidbits.uucp>.  Enjoy!
  449.  
  450.   From setext-list Sun, 15 Mar 14:55:00 1992 +0100 (CET)
  451.   Subject: what makes a setext (sermon #1)
  452.   Status: RO
  453.  
  454.     ermons etexts
  455.     rmonse textse
  456.     monset extser
  457.     onsete xtserm
  458.     nsetex tsermo
  459.     setext sermon
  460.  
  461.     920315     #1
  462.  
  463.  
  464.   Hi everybody
  465.  
  466.   Welcome.  Here's the first installment of the setext mailing
  467.   list.  My intention is to serve a lively mix of format
  468.   specifications, questions-and-answers and browser implementation
  469.   trivia ("quick!  which of Macintosh word processors was first
  470.   with a built-in outliner?"  ;-)) Please be forgiving of Muddy
  471.   English[tm], if any; I now run without the benefit of a spelling
  472.   checker but even if I had one, it would hardly matter,
  473.   comprehension- or otherwise.
  474.  
  475.   ---Ian
  476.  
  477.  
  478. What makes a setext?
  479. --------------------
  480.  
  481.   As mentioned in the concepts document (available from TidBITS
  482.   fileserver; details on how to obtain it last in any TidBITS
  483.   issue) the setext format relies on a small number of highly
  484.   unobtrusive tagging elements to encode the logical structure of
  485.   source documents.  This structure can later be restored at the
  486.   receiving end, according to rules supplied by each particular
  487.   front-end's writer.  It follows that it is entirely possible to
  488.   treat the same setext differently depending on rules embedded it
  489.   the particular application that is used for reading of it. 
  490.   Indeed, presence of key typotags in the same setext may in one
  491.   instance be understood only as flags for change of typefaces and
  492.   sizes and in another as logic markers signalling that flagged
  493.   elements be entered into a local database.  This formal
  494.   decoupling of logical structure from typography during the
  495.   online-transport stage is part of the beauty of setext.
  496.  
  497.   Still, before any decoding can take place a text has first to be
  498.   verified whether it is a setext and not some arbitrarily-wrapped
  499.   stream of characters.  Although there are more ways than one to
  500.   achieve that goal there is one _primary_ test that has to be
  501.   passed with colors or else the text being tested cannot be a
  502.   setext.  What ought to be done with thus "rejected" texts will
  503.   be discussed in an upcoming notice.  This one is all about
  504.   finding out whether to proceed with parsing at all.
  505.  
  506.   Chief among the typotags are two that signal presence of setext
  507.   titles and subheads inside the text.  A setext document can be
  508.   formatted more or less properly, may contain or lack any other
  509.   of its "native" elements but it has to have at least one proper
  510.   subhead or a title in order to be declared as "a certified
  511.   setext."
  512.  
  513.  
  514. Here are few sample setext subheads:
  515. ------------------------------------
  516.  
  517. _ _ _ _ Which Share Just One _ _ _ _
  518. ------------------------------------
  519.  
  520.         ----------> UnifyinG FeaturE
  521. ------------------------------------
  522.  
  523. of EQUAL RIGHTMOST VISIBLE character
  524. ------------------------------------
  525.  
  526.   length as that of its subhead-tt's
  527. ------------------------------------
  528.  
  529. [this line is called subhead-string]
  530. ------------------------------------
  531.  
  532. [the one below is called subhead-tt]
  533. ------------------------------------
  534.  
  535. [together they make a valid subhead]
  536. ------------------------------------
  537.  
  538.     (!) and of course, subheads do not have to be of the same length ;-)
  539. ------------------------------------------------------------------------
  540.  
  541.    (nor have to begin in column 1)
  542. ----------------------------------
  543.  
  544.   although it is recommended that they stay below 40 characters
  545. ---------------------------------------------------------------
  546.  
  547.  
  548. Second Setext In This File
  549. ==========================
  550.  
  551.   ((end of examples))
  552.   -------------------
  553.   ((_not_ a subhead))
  554.  
  555.   Chief among the reasons why one should first look for presence
  556.   of subheads rather than titles is that it is fully conceivable
  557.   that a setext might have been created without an explicit
  558.   title-tt in order to allow decoder programs to distinguish
  559.   between part one and any subsequent ones in a possible
  560.   multi-part mailing.  This absence of a title-tt could be enough
  561.   of a signal to start looking for possible "part x of y" message
  562.   in either the subject line, filename or anywhere "above" the
  563.   first detected subhead of the current text.
  564.  
  565.   Therefore, here's a formal definition of what makes a setext:
  566.  
  567.   a text that contains at least one verified setext subhead or
  568.   setext title
  569.  
  570.  
  571. RIGHTMOST VISIBLE char length of subheads and titles
  572. ----------------------------------------------------
  573.  
  574.   What, pray, is meant by that?  It is a very important point: a
  575.   properly-formatted setext subhead is made up of a
  576.   subhead-string, (less than 80 characters long), followed by a
  577.   line consisting of an equal number of dash characters, (ASCII
  578.   45/ hex 2d) counted from column 1 to the RIGHMOST subhead-string
  579.   column, including possible leading white space.  For instance,
  580.   the subhead above is made up of a subhead-string with a total
  581.   length of 56 characters, of which 1 is a leading and 4 are
  582.   trailing ("invisible") blanks.  Rightmost visible length of both
  583.   the subhead-string and its all-dash-typotag line is 52
  584.   characters however.  This is what makes that pair of lines into
  585.   a verified setext subhead.
  586.  
  587.   Indeed, this positive-vetting mechanism is the basis on which
  588.   the setext format rests...  all-dash or all-equal-sign lines
  589.   doing the double duty of being both machine-recognizable flags
  590.   for detection of subheads or titles AND visual underline
  591.   elements in their own right.  Trailing blanks and tabs are
  592.   simply a nuisance which has to be taken into the account.  They
  593.   may have been inserted there inadvertedly or appeared as a
  594.   result of either line been pasted in from another source and
  595.   survived the encoding process.  Automatic setext-assembly
  596.   routines will create 100%-clean subheads but since setexts are
  597.   so easy to code wholly by hand the possibility of a subheads
  598.   with in reality invisible trailing tabs or spaces cannot be
  599.   discounted entirely, as is the case with several among the
  600.   sample subheads above).  Therefore the only proper way to
  601.   validate a subhead (or a title) is to do it in like fashion:
  602.  
  603.  
  604.   (a) scan forward for a line that's made up of at least 2 leading
  605.       dash characters (=minimum length; a practical consideration)
  606.       with possible trailing white space (spaces, tabs and other
  607.       defacto invisible [control] characters).  If applicable,
  608.       grep all such lines globally using the pattern
  609.       "^-+[-\s\t]*$"
  610.  
  611.   (b) if no lines found, repeat the search for title-typotags ("=").
  612.  
  613.   (c) if no lines found then the text is not a setext. Display it
  614.       using the default behavior. End of verification process.
  615.  
  616.   (d) if either (a) or (b) returns one or more lines, then each of
  617.       these will have to be checked for being part of a setext
  618.       subhead or title.
  619.  
  620.   (f) if first returned line is equal to the first physical line in
  621.       the buffer or file then proceed with the next instance. First
  622.       possible line number on which a typotag could be present is 2.
  623.       As long as the list is not empty repeat for each line in the
  624.       returned list:
  625.  
  626.   (g) calculate which line it is, counting from the chosen index (like
  627.       the beginning of file or the text buffer).  Assign this value to
  628.       a variable "ttPtr."
  629.  
  630.   (h) strip (a copy of) line ttPtr of the text of any _trailing_ tabs,
  631.       spaces and possible other invisible characters
  632.  
  633.   (i) extract the character length (count the number of dash chars);
  634.       store it in a local variable "ttLength"
  635.  
  636.   (j) strip (a copy of) line ttPtr-1 of the text of any _trailing_
  637.       tabs, spaces and possible other invisible characters; store the
  638.       trailing-blankless result in a local variable "sString"
  639.  
  640.   (k) extract the number of characters in sString (incl possible
  641.       _leading_ indent); store it in a local variable "sLength"
  642.  
  643.   (l) compare ttLength to sLength; if they match then declare line
  644.       ttPtr-1 to be a subhead; output sString to display (with chosen
  645.       typographical enhancements if needed; line ttPtr itself doesn't
  646.       have to be displayed of course).
  647.  
  648.   (m) start the next parsing loop
  649.  
  650.  
  651. an example in HyperTalk
  652. -----------------------
  653.  
  654.   Though the above appears complicated in reality it is a sequence
  655.   of very simple, straightforward operations.  Here is how it may
  656.   be implemented in HyperTalk using just one recursive grep() XFCN
  657.   call (v 3.1 by Greg Anderson):
  658.  
  659.   get greptts("-") ---result is EITHER a verified list of subheads or
  660.   --------------------titles OR empty --> the text cannot be a setext
  661.   ----a second greptts("=") call is required for detection of titles!
  662.   ----text being verified is assumed to have been read into a global;
  663.   ----it takes 6-8 seconds on an SE to verify a sample 44KB file made
  664.   ----up of 2 titles + 12 subheads incl. a few confusing non-subheads
  665.  
  666.   function greptts ttchar ------------ttchar may be either "-" or "="
  667.     global myText
  668.     get "^" &ttchar &ttchar --first grep pattern is 2 leading ttchars
  669.     put "[" "e &char offset(ttchar,"-=") of "=-" ~~ --second pass
  670.     &"!-,\./A-Za-z;<>?@[-~]" into pattern ----required to account for
  671.     get grep(v,pattern,grep(n,it,myText)) ---grep XFCN implementation
  672.     if it<>empty then return topicList(it,ttchar="=") else return ""
  673.   end greptts --else: no RAW title/ subhead-typotags were encountered
  674.  
  675.   function topicList ttList,titleflag --controls type of verification
  676.     global myText
  677.     if char 1 to offset(":",ttList)-1 of ttList =1
  678.     then delete line 1 of ttList
  679.     put empty into verifiedList -----------initialize return variable
  680.     if ttList<>empty then
  681.       repeat with i=1 to number of lines in ttList
  682.         get line i of ttList
  683.         put (char 1 to offset(":",it)-1 of it)-1 into ttptr
  684.         get length(word 2 of it) ----------------------------ttLength
  685.         put blankLess(line ttptr of myText) into sString
  686.         if length(sString)=it then
  687.           put ttptr &"," after verifiedList
  688.           if param(2) then get return else get pure(sString) &return
  689.           put it after verifiedList
  690.         end if
  691.       end repeat
  692.     end if
  693.     return verifiedList
  694.   end topicList
  695.  
  696.   function blankLess aStr ----string stripped of trailing white space
  697.     get space &numtochar(9) ---------------assign a space-tab pattern
  698.     repeat with i=length(aStr) down to 1 -----to  local variable "it"
  699.       if char i of aStr is not in it then return char 1 to i of aStr
  700.     end repeat
  701.     return empty
  702.   end blankLess
  703.  
  704.   function pure aStr --string stripped of leading and trailing blanks
  705.     return word 1 to 99999 of aStr -----an arbitrarily large value is
  706.   end pure -----decoded faster by HyperTalk than "number of words in"
  707.  
  708.  
  709. Administrivia 920315
  710. --------------------
  711.    
  712.   There are 35 names on this mailing list, all of you who have
  713.   expressed interest either as front-end writers or present/
  714.   future setext publishers.  I've heard of a few TidBITS browsers
  715.   having already been written in HyperCard, none of them a proper
  716.   setext tool, however, but most probably decoders of some of the
  717.   more easily-recognizable layout elements of it.  I hope that the
  718.   above example is enough to demonstrate that doing it properly
  719.   isn't all that more difficult than doing it in a quickie-hack
  720.   fashion.
  721.  
  722.  
  723.   ------------------------------------------> end of setext sermon #1
  724.   edited <----- Ian Feldman <ianf@random.se>
  725.   inquiries --> setext-list@random.se
  726.   ------------> setext, the structure-enhanced text concepts document
  727.   (last changed March 92) may be requested by sending "setext" alone
  728.   on the subject line, no quotes, to <fileserver@tidbits.halcyon.com>
  729. ..
  730.  
  731.  
  732. ------------------------------------------------------------------
  733.  
  734.  
  735. Setext Sermon #2
  736. ================
  737.  
  738.   From setext-list Sun, 29 Mar 23:48:00 1992 +0100 (CET)
  739.   Subject: setext_sermon#2.txt
  740.   Status: RO
  741.  
  742.     ermons etexts
  743.     rmonse textse
  744.     monset extser
  745.     onsete xtserm
  746.     nsetex tsermo
  747.     setext sermon
  748.  
  749.     920329     #2
  750.  
  751.  
  752. Two types of setext
  753. -------------------
  754.  
  755.   The fact that the format has been optimized for requirements
  756.   (and vagaries!)  of online-transported text publications can
  757.   easily lead one to believe that all setexts are by necessity
  758.   confined to pure ASCII (7-bit) text.  Actually, it is not so. 
  759.   The setext has been named for what it is primarily about,
  760.   structural enhancement of any text, not just that of the ASCII
  761.   text.  Therefore none of the typotags chosen for encoding of the
  762.   structure either rely on or care about whether the text being
  763.   wrapped is of the 7- or 8-bit variety.
  764.  
  765.   Both types of source documents can be made equally structured,
  766.   with the only difference being their final suitability for the
  767.   intended transport route.  If a setext is to be distributed via
  768.   the 7-bit electronic mail then, of course, no other option
  769.   remains than to make sure that it contains nothing but ASCII
  770.   characters.  On the other hand, if it's to become part of an
  771.   otherwise encoded package (such as a binhexed archive in which
  772.   documentation files have been setextized) then there may be no
  773.   clear-cut reason not to use the full 8-bit character set where
  774.   so called for.
  775.  
  776.  
  777. Other considerations
  778. --------------------
  779.  
  780.   Once a decision has been reached to use 8-bit characters in a
  781.   setext a possibility arises to keep the paragraph text
  782.   unwrapped, rather than folded uniformly at the 66th character
  783.   mark.  After all, if the setext is primarily to be displayed
  784.   inside an editor, rather than on an 80-character terminal
  785.   screen, then there is not much sense in prior folding of the
  786.   lines to a specific guaranteed- to-fit-on-a-TTY-screen length. 
  787.   The editor/ word processor program will fit the unwrapped text
  788.   to window or the available display area, and might actually
  789.   prefer to have to deal with whole unwrap- ped paragraphs rather
  790.   than with otherwise relatively-short lines.
  791.  
  792.   Most text-processing programs with native word-wrap capabilities
  793.   actually consider return-terminated lines to be paragraphs in
  794.   their own right.  Besides, if a setext is not to travel via
  795.   email anyway (because of it being distributed differently or
  796.   making use of accented characters) then it might as well arrive
  797.   in unfolded state so that no extra time need to be spent on
  798.   making the paragraphs "whole again."
  799.  
  800.   Do observe, however, that it is not the state of the paragraph
  801.   text that makes or breaks a setext.  No, the sole criterion of
  802.   whether a text is a setext is the presence of at least one
  803.   verified subhead, as described in the previous sermon (#1). 
  804.   Thus even texts with unfolded paragraphs (i.e. terminated by
  805.   carriage returns, similar to lines in HyperTalk that can be up
  806.   to 30000 characters in length) are setexts if they contain at
  807.   least one subhead-tt.
  808.  
  809.   The sole mechanism used in setext to encode which of such lines
  810.   are in reality paragraphs (as opposed to those that shouldn't be
  811.   folded mechanically) is the character indent.  In fact, the
  812.   second (after the subhead-tt) most important typotag is the
  813.   indent-tt, made up of exactly two space characters, which
  814.   denotes thus indented lines as ready-candidates for reflowing by
  815.   so inclined front-ends (either on their own or as part of
  816.   like-indented lines above and below it).  So any
  817.   potentially-long line of a setext that has been indent-tted will
  818.   be understood (by any validated setext front-end) to be ready
  819.   for wrapping-to-length if so required.
  820.  
  821.  
  822. An example of unwrapped paragraph
  823. ---------------------------------
  824.   
  825.   For instance, this paragraph has specifically been unfolded to demonstrate the
  826.  validity of the concept: indent-tted, yet still-unwra 
  827. pped line in a setext
  828.   piece makes it into a paragraph of its own.  Depending on the type of the
  829.   terminal software at your end it will most probably be folded at some
  830.   "mechanical 79-th character mark" and fill the available window's width.
  831.   Imported into a word processor it will end up word-wrapped and thus 
  832. become easy
  833.   to add to or delete from, since the program will simply r
  834.  
  835.  
  836. Primary setext-type distinction
  837. -------------------------------
  838.  
  839.   Still, if all the texts that fulfill the sole basic validated-
  840.   subhead requirement are to be considered setexts then the need
  841.   arises to distinguish between the "pure" variety of them, those
  842.   encoded for 7-bit transport duty (no accented characters AND
  843.   with ready-folded paragraphs), and all the other ones.  Indeed,
  844.   this is an important point which also has been addressed.
  845.  
  846.   As originally explained setext documents in online distribution
  847.   should be denoted by the ".etx" suffix (which stands for both
  848.   "emailable" and "enhanced text.")  In reality this suffix should
  849.   ONLY be used for setexts of that "pure" variety, as are the
  850.   current TidBITS that carry it at sumex and elsewhere.  All the
  851.   other setexts, either the not-fully-7-bit ones, or those with
  852.   unfolded paragraphs (as the one above) may carry a more common
  853.   ".txt" suffix, but not an ".etx" one.  They are setexts too but
  854.   as they definitely are _not_ guaranteed to fare well in
  855.   electronic mail transport then their titles should not signal
  856.   that special "setext.etx" status either (to readers and
  857.   front-ends that are aware of the distinction).  It is enough
  858.   that their titles be indicative of them being simply
  859.   "text_documents.txt."
  860.  
  861.   Therefore: fully 7-bit/ 66-char-folded setexts may carry the
  862.   .etx suffix.  All the other setexts: .txt ONLY suffix, please,
  863.   as does this issue of the sermon (on account of the unwrapped
  864.   paragraph).._.
  865.  
  866.  
  867.  
  868. Change of topic: delete functions
  869. ---------------------------------
  870.  
  871.   Akif Eyler, <eyler@trbilun.bitnet>, who's adapting an existing
  872.   document browser for setexts (a MacApp hack) writes on the
  873.   subject of by me suggested point to allow selective deletion of
  874.   parts of a browsed setext:
  875.  
  876.   > We are talking about a browser, not an editor. I don't think
  877.   > text modification should be allowed here.
  878.  
  879.   This is an important point that deserves a little more comment
  880.   than that.  I believe that we may be talking about two different
  881.   things.  Although it is true that a "browser" is basically an
  882.   application for structured paging of text there is nothing to
  883.   prevent such applications from offering additonal services that
  884.   may be appropriate or of great value to its users.
  885.  
  886.   So while technically we both may be right, in this respect, when
  887.   speaking of "browsers", I mean "setext tools" rather than the
  888.   more traditional, straigh-browse-function-only, implementations.
  889.  
  890.   You should keep in mind the basic difference between a
  891.   traditional browser, designed for navigation in a potentially
  892.   VERY LARGE data mass and that of a setext front-end, meant to be
  893.   used with texts of limited size (<50K mainly).  Such short texts
  894.   are inherently easier to read without assistance of any special
  895.   tools, even if using one is to be recommended.  But let us not
  896.   believe that people will start using a browser only because one
  897.   is available.  After all, a "typical" setext might contain
  898.   20-odd "pages" of text, which are not that hard to browse using
  899.   the standard ways and means of ANY application (scrollbars on
  900.   the Mac etc).
  901.  
  902.   For that reason alone I feel that setext browsers should offer a
  903.   few other facilities in order to make using them worthwhile to
  904.   the users...  with the prime among such values-added functions
  905.   being a method to delete portions of read setexts, in as simple
  906.   a manner as possible.  After all setexts are not guaranteed to
  907.   survive editing and the format as such is intended for periodic
  908.   online publications.  And what do we do with interesting
  909.   articles in print magazines?  We clip them out and discard the
  910.   rest.  So any such Easy-Delete[tm] function wouldn't entirely be
  911.   out of place in setext reading (while definitely an unwanted
  912.   proposition when browsing of [large] _reference_ works etc).
  913.  
  914.   So what constitutes such "Easy-Delete"?  In my view a browser
  915.   should allow _unobtrusive_ deletion of text in either or both of
  916.   the following ways:
  917.  
  918.   (a) a whole current topic may be flagged for deletion.  That
  919.       does not take place until browsing of the setext is terminated,
  920.       however (by reading in of another setext or closing of the
  921.       application), at which time the originally-read-in setext gets
  922.       written back to disk less the flagged portions.  It goes without
  923.       saying that such flagging actions should be undoable before the
  924.       rewritting takes place.  The latter should happen automatically,
  925.       without prior and explicit replace-confirmation? dialogs.
  926.  
  927.   (b) selected text-chunk onscreen may simply be deleted by
  928.       pressing the delete or clear keys.  It should disappear from the
  929.       display at once but _could_ be removed from file first upon
  930.       termination of the browsing-of-current-setext operation (as per
  931.       above).  This function does not have to be undoable as the text
  932.       may be preserved by reading-in of it once again.
  933.  
  934.   i.e. the browser keeps track of opened file(s) and if one such
  935.   is opened again then it simply forgets about any queued
  936.   selective deletes in current text and replaces the contents of
  937.   the buffer with a clean copy from the disk.
  938.  
  939.   As above, no explicit confirmation should be required first.  If
  940.   you delete something then you delete something, and there should
  941.   be no need to explain it once again to the machine that you did
  942.   it on purpose.  On the other hand care should be taken to
  943.   prevent inadvertent destruction of browsed setexts, perhaps by
  944.   requiring that selection of text be made with the option (or
  945.   command) key pressed down, or that Command-Delete be required to
  946.   flag a whole topic for removal.  On top of that the
  947.   really-important documents, those not intended to be rewritten
  948.   during browsing, should be kept locked on disk anyway.
  949.  
  950.  
  951.   ------------------------------------------> end of setext sermon #2
  952.   edited <----- Ian Feldman
  953.   inquiries --> setext-list@random.se
  954.   ------------> setext, the structure-enhanced text concepts document
  955.   (last changed March 1992; do not reorder if you've already seen it)
  956.   may be requested by sending "setext" alone on the Subject: line, no
  957.   quotes, empty message body to ----------> <fileserver@tidbits.uucp>
  958.  
  959.   
  960. ------------------------------------------------------------------
  961.  
  962.  
  963. Setext Markup Specification v9
  964. ==============================
  965.  
  966.   current (online) use  setext form          shown as in a        name of
  967.   of text emphasis      of same              setext frontend  the typotag [?]
  968.   ~~~~~~~~~~~~~~~~~~~~  ~~~~~~~~~~~~~~~~~~~  ~~~~~~~~~~~~~~~ ~~~~~~~~~~~~ ~~~
  969.   Internet mail header  From <source>        Subject: shown     header-tt [a]
  970.   (start of a message)  minimal mail header  [Date: & From:]
  971.   --------------------  -------------------  --------------- ------------ ---
  972.   title (1 per text)   "Title                a title             title-tt [b]
  973.   in a distinct style   ====="               in chosen style
  974.   --------------------  -------------------  --------------- ------------ ---
  975.   heading (1+/ text)   "Subhead              a subhead         subhead-tt [c]
  976.   in a distinct style   -------"             in chosen style
  977.   --------------------  -------------------  --------------- ------------ ---
  978.   body text               66-char lines in-  lines undented     indent-tt [d]
  979.   [plain not-indented]    dented by 2 space  and unfolded
  980.   --------------------  -------------------  --------------- ------------ ---
  981.   1+ bold word(s)           **[multi]word**  1+ bold word(s)      bold-tt [e]
  982.   a single italic word               ~word~  1 italic word      italic-tt [f]
  983.   1+ underlined words        [_multi]_word_  underlined text underline-tt [g]
  984.   hypertextual 1+ word        [multi_]word_  1+ hot word(s)        hot-tt [h]
  985.   >followed by text     >[space][text]       > [mono-spaced]     quote-tt [i]
  986.   bullet-text in pos 1  *[space][text]       [bullet] [text]    bullet-tt [j]
  987.   --------------------  -------------------  --------------- ------------ ---
  988.   end of first? setext  $$ [last on a line]  [parse another]   twobuck-tt [k]
  989.                         ..[space][not dot]   [line hidden]    suppress-tt [l]
  990.   logical end of text   ..[alone on a line]  [taken note of]    twodot-tt [m]
  991.   ====================  ===================  =============== ============ ===
  992.  
  993. ..
  994.